import React, { SFC } from 'react';
import { Modal } from 'antd';
import { ModalStatus } from '@/constants/common';
import styles from './index.less';

interface DetailModalProps {
  modalStatus: ModalStatus;
  title: string;
  hideModal: () => void;
}

const DetailModal: SFC<DetailModalProps> = (props) => {
  const { modalStatus, hideModal, title, children } = props;

  return (
    <Modal
      className={styles.detailModal}
      visible={modalStatus === ModalStatus.Detail}
      onCancel={hideModal}
      title={<div style={{ textAlign: 'center' }}>{title}</div>}
      footer={null}
    >
      {children}
    </Modal>
  );
};

export default DetailModal;
